package adv5;

//这个例子演示了Reader的用法
import java.io.*;

public class FileReader2 {

	public static void main(String[] args) {
		System.out.println(System.getProperty("file.encoding"));
		try {
			// 前后一致
			Reader r = new FileReader("e:/Temp/String.txt");
			char c[] = new char[30];
			int len = 0;
			while ((len = r.read(c)) > 0) {
				String s = new String(c, 0, len);
				System.out.print(s);
			}
			r.close();
		} catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
	}

}
